/*Joseph A. Coll
8/27/2023
Methods for Measuring the Extent to Which Voter Fraud Beliefs Link Election Reforms to Voter Confidence in the United States 
*/

*Load Data 
use "Coll Measuring Data.dta", clear

********************************************************************************		
********************************************************************************
********************************************************************************		
*Rep
********************************************************************************
********************************************************************************		
********************************************************************************		
*Covi-->Confidence no fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		  /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if rep == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	rep_state_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(rep_state_covi, replace) ///
		title(M1: COVI to Confidence (R), size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
*Covi->Fraud
		reg voter_fraud_scale /// DV
		c.covi_updated ///COVI
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   ///a Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if rep == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	rep_fraud_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		replace rep_sample = 1 if e(sample)==1
			
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(rep_fraud_covi, replace) ///
		title(M2: COVI to Fraud Beliefs (R), size(medium) color(black)) ///
		ytitle("Voter Fraud Beliefs (0-100)", height(5)) ///
		yscale(r(0 100)) ylabel(0(20)100, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))		
		
*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if rep == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	rep_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
	
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=50 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(rep_state_covi_fraud, replace) ///
		title("M3: COVI (& Fraud) to Confidence (R)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
				
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
 		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(rep_state_fraud_covi, replace) ///
		title("M3: Fraud (& COVI) to Confidence (R)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
	
		*Figure B2 in Appendix B
		graph combine rep_state_fraud_covi rep_state_covi_fraud

*Rep mediation
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time  voted_early voted_mail  wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if rep  == 1 , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev)
		estimates store med_rep
		esttab med_rep
		
 		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if rep  == 1, ///
		mediate(voter_fraud_scale) treat(covi_updated  )  graph	sims(1000)		
		
twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average Mediation Effect") xtitle("Sensitivity parameter: {it:p}") legend(off) title("Republicans", color(black)) graphregion(color(white))

drop _med*

********************************************************************************
********************************************************************************
********************************************************************************
*Democrats
********************************************************************************
********************************************************************************
********************************************************************************
*Covi-->Confidence no fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		  /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if dem == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	dem_state_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"		
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		  ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(dem_state_covi, replace) ///
		title(M4: COVI to Confidence (D), size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
*Covi->Fraud
		reg voter_fraud_scale /// DV
		c.covi_updated ///COVI
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if dem == 1  ///
		[pw=weight], robust cluster(state_fips)
		estimates store	dem_fraud_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
 		replace dem_sample = 1 if e(sample)==1
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		  ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0) ///
		saving(covi_fraud_dem, replace)
		
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(dem_fraud_covi, replace) ///
		title(M5: COVI to Fraud Beliefs (D), size(medium) color(black)) ///
		ytitle("Voter Fraud Beliefs (0-100)", height(5)) ///
		yscale(r(0 100)) ylabel(0(20)100, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
 	
*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if dem  == 1  ///
		[pw=weight], robust cluster(state_fips)
		estimates store	dem_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
			
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=20 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(dem_state_covi_fraud, replace) ///
		title("M6: COVI (& Fraud) to Confidence (D)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
			
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(dem_state_fraud_covi, replace) ///
		title("M6: Fraud (& COVI) to Confidence (D)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))

		*Figure B2 in Appendix B
		graph combine dem_state_fraud_covi dem_state_covi_fraud
		
*Dem Mediation
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail   wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if dem == 1  , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev)
		estimates store med_dem
		esttab med_dem
		
 		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if dem  == 1, ///
		mediate(voter_fraud_scale) treat(covi_updated  )  sims(1000)		
		

twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average Mediation Effect") xtitle("Sensitivity parameter: {it:p}") legend(off) title("Democrats", color(black)) graphregion(color(white))

drop _med*
		
********************************************************************************
********************************************************************************
********************************************************************************
*Table 1
********************************************************************************
********************************************************************************
********************************************************************************
		esttab rep_state_covi rep_fraud_covi rep_state_covi_fraud dem_state_covi dem_fraud_covi dem_state_covi_fraud ///
		using coll_COVI_Conf_T1PID.rtf, replace ///
		cells(b( fmt(3)) p(fmt(3) par)) ///
		label note("All models estimated with linear regression, robust standard errors clustered by state, include year fixed effects, and are weighted to be state representative of registered voters. P-values shown in parentheses.") ///
		ar2 obslast ///
		nodepvars nobase noomitted eqlabel("") interaction(" x ") ///
			order( covi_updated ///COVI
				voter_fraud_scale /// Fraud
				   ///
				 voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
				voted_for_winner  liberalism poli_int two_party_margin_perc   /// Poli Characteristics
				age income_mean educ married female /// SES
				hispanic black_non_hispanic other_non_hispanic  ) /// Laws 
				  ///
			drop(*.year) ///
		title("Table XX: Voter Restrictions, Voter Fraud Beliefs, and Voter Confidence Among Republicans and Democrats") ///
		mlabel("COVI to Confidence" "COVI to Fraud Beliefs" "COVI to Confidence w. Fraud Beliefs" ///
		"COVI to Confidence" "COVI to Fraud Beliefs" "COVI to Confidence w. Fraud Beliefs") ///
		mgroups("Republicans" "Democrats", pattern( 1 0 0 1 ))
		
********************************************************************************
********************************************************************************
********************************************************************************
*Figure 1
********************************************************************************
********************************************************************************
********************************************************************************
graph combine rep_state_covi rep_fraud_covi rep_state_covi_fraud dem_state_covi dem_fraud_covi dem_state_covi_fraud, ///
graphregion(color(white))
		
		
********************************************************************************
********************************************************************************
********************************************************************************
*Appendix A: Summary Stats
********************************************************************************
********************************************************************************
********************************************************************************
		
sum confidence_statevote_binary voter_fraud_scale /// DV
	c.covi_updated ///COVI
	voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
	voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
	age income_mean educ married female /// SES
	hispanic black_non_hispanic other_non_hispanic [aw=weight] 

sum confidence_statevote_binary voter_fraud_scale /// DV
	c.covi_updated ///COVI
	voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
	voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
	age income_mean educ married female /// SES
	hispanic black_non_hispanic other_non_hispanic  [aw=weight] if dem == 1

sum confidence_statevote_binary voter_fraud_scale /// DV
	c.covi_updated ///COVI
	voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
	voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
	age income_mean educ married female /// SES
	hispanic black_non_hispanic other_non_hispanic  [aw=weight] if ind == 1

sum confidence_statevote_binary voter_fraud_scale /// DV
	c.covi_updated ///COVI
	voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
	voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
	age income_mean educ married female /// SES
	hispanic black_non_hispanic other_non_hispanic  [aw=weight] if rep == 1
	
********************************************************************************
********************************************************************************
********************************************************************************
*Appendix B: Voter Fraud Diagnostics
********************************************************************************
********************************************************************************
********************************************************************************
		
alpha fraud_voter fraud_impersonation fraud_noncitizen fraud_wrongabsentee
factor fraud_voter fraud_impersonation fraud_noncitizen fraud_wrongabsentee
screeplot , ///
graphregion(color(white)) ///
title("Scree Plot of Eigen Values") ///
 xtitle("Number of Factors")

*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if rep == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	rep_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
	
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=50 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(rep_state_covi_fraud, replace) ///
		title("M3: COVI (& Fraud) to Confidence (R)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
				
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
 		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(rep_state_fraud_covi, replace) ///
		title("M3: Fraud (& COVI) to Confidence (R)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
	
		*Figure B2 in Appendix B
		graph combine rep_state_fraud_covi rep_state_covi_fraud
		
*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if dem  == 1  ///
		[pw=weight], robust cluster(state_fips)
		estimates store	dem_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
			
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=20 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(dem_state_covi_fraud, replace) ///
		title("M6: COVI (& Fraud) to Confidence (D)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
			
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(dem_state_fraud_covi, replace) ///
		title("M6: Fraud (& COVI) to Confidence (D)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))

		*Figure B2 in Appendix B
		graph combine dem_state_fraud_covi dem_state_covi_fraud
		

********************************************************************************
********************************************************************************
********************************************************************************
*Appendix C: Confidence in State Vote Counts and Fraud Beliefs by Party and Year
********************************************************************************
********************************************************************************
********************************************************************************
		
*Confidence
tab confidence_statevote_binary year [aweight=weight], col
tab confidence_statevote_binary [aweight=weight]
tab confidence_statevote_binary [aweight=weight] if dem ==1,  
tab confidence_statevote_binary year [aweight=weight] if dem ==1, col
tab confidence_statevote_binary   [aweight=weight] if rep ==1 
tab confidence_statevote_binary year [aweight=weight] if rep ==1, col
tab confidence_statevote_binary year [aweight=weight] if ind ==1, col
tab confidence_statevote_binary   [aweight=weight] if ind ==1 

	*Vote count confidence with full scale
	tab confidence_statevote
	tab confidence_statevote  [aweight=weight] if dem ==1
	tab confidence_statevote  [aweight=weight] if rep ==1 
	tab confidence_statevote  [aweight=weight] if ind ==1 

*Fraud beliefs
sort year
by year: sum voter_fraud_scale [aweight=weight]
sum voter_fraud_scale [aweight=weight]
by year: sum voter_fraud_scale if dem ==1 [aweight=weight]
sum voter_fraud_scale if dem ==1 [aweight=weight]
by year: sum voter_fraud_scale if ind ==1 [aweight=weight]
sum voter_fraud_scale if ind ==1 [aweight=weight]
by year: sum voter_fraud_scale if rep ==1 [aweight=weight]
sum voter_fraud_scale if rep ==1 [aweight=weight]

		
********************************************************************************
********************************************************************************
********************************************************************************
*Appendix D: COVI and Public Opinion
********************************************************************************
********************************************************************************
********************************************************************************

/*NOTE: This appendix uses different data than the main manuscript. It has been commented out so that replicators can run the main models without running into issues.  	
use "Coll Measuring Data Appendix D", clear

tab covi_updated4 ease_vote, col chi
tab covi_updated4 ease_comparative , col chi
*/
********************************************************************************
********************************************************************************
********************************************************************************
*Appendix E: Moderation analyses
********************************************************************************
********************************************************************************
********************************************************************************

*Rep
*Covi-->Confidence with Fraud Interaction
		reg confidence_statevote_binary /// DV
		c.covi_updated##c.voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if rep == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	rep_state_covi_fraud_int
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
	
		margins, at(covi_updated=(-1.4(.2)1.4) voter_fraud_scale=(10(80)90) ///
		///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=2 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=54 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
 		name(rep_state_covi_fraud_int, replace) ///
		title("Moderation of COVI by Fraud Beliefs (R)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ci1opt(color(black)) ///
		plot1opts(lcolor(black) msymbol(T) mcolor(black)) ///
		ci2opt(lcolor(gs7) color(gs7)) ///
		plot2opts(lcolor(gs7) msymbol(O) mcolor(gs7)) ///
		legend(pos(6) order(4 "High Fraud" 3 "Low Fraud") col(2))
								
*Rep mediation
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time  voted_early voted_mail  wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  interaction    liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if rep  == 1 , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev) interact(interaction)
		estimates store med_rep
		esttab med_rep
		
 		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  interaction    liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if rep  == 1, ///
		mediate(voter_fraud_scale) treat(covi_updated  )  graph	sims(1000)		
		
twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average mediation effect") xtitle("Sensitivity parameter: p") legend(off) title("Sensitivity Analysis for Republican Sample(p)", color(black)) graphregion(color(white))

drop _med*

*Democrats
*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated##c.voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if dem == 1  ///
		[pw=weight], robust cluster(state_fips)
		estimates store	dem_state_covi_fraud_int
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"

		margins, at(covi_updated=(-1.4(.2)1.4) voter_fraud_scale=(10(80)90) ///
		  ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=1  liberalism=4 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=50 income_mean=7 educ=3 married=0 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
 		name(dem_state_covi_fraud_int, replace) ///
		title("Moderation of COVI by Fraud Beliefs (D)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ci1opt(color(black)) ///
		plot1opts(lcolor(black) msymbol(T) mcolor(black)) ///
		ci2opt(lcolor(gs7) color(gs7)) ///
		plot2opts(lcolor(gs7) msymbol(O) mcolor(gs7)) ///
		legend(pos(6) order(4 "High Fraud" 3 "Low Fraud") col(2))

*Dem Mediation
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail   wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner interaction     liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if dem == 1  , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev) interact(interaction)
		estimates store med_dem
		esttab med_dem
		
 		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if dem  == 1, ///
		mediate(voter_fraud_scale) treat(covi_updated  )  sims(1000)		
		

twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average mediation effect") xtitle("Sensitivity parameter: p") legend(off) title("Sensitivity Analysis for Democrat Sample(p)", color(black)) graphregion(color(white))

drop _med*
		
*Table 1
		esttab rep_state_covi_fraud_int dem_state_covi_fraud_int ///
		using coll_COVI_Conf_T1PID_TM_INT.rtf, replace ///
		cells(b( fmt(3)) p(fmt(3) par)) ///
		label note("All models estimated with linear regression, robust standard errors clustered by state, include year fixed effects, and are weighted to be state representative of registered voters. P-values shown in parentheses.") ///
		ar2 obslast ///
		nodepvars nobase noomitted eqlabel("") interaction(" x ") ///
			order( covi_updated ///COVI
				voter_fraud_scale /// Fraud
				   ///
				 voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
				voted_for_winner  liberalism poli_int two_party_margin_perc   /// Poli Characteristics
				age income_mean educ married female /// SES
				hispanic black_non_hispanic other_non_hispanic  ) /// Laws 
				  ///
			drop(*.year) ///
		title("Table XX: Voter Restrictions, Voter Fraud Beliefs, and Voter Confidence Among Republicans and Democrats") ///
		mlabel("Republicans" "Democrats") 
		
*Figure 1
graph combine rep_state_covi_fraud_int dem_state_covi_fraud_int, ///
graphregion(color(white))
		
********************************************************************************
********************************************************************************
********************************************************************************
*Appendix E: Genera Pop and Independents
********************************************************************************
********************************************************************************
	*Full Sample
	*Covi-->Confidence no fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		  /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year ///
		[pw=weight], robust cluster(state_fips)
		estimates store	gp_state_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  dem=0 rep=0 liberalism=3 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=52 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)

		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(gp_state_covi, replace) ///
		title(M1: COVI to Confidence (All), size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
	*Covi->Fraud
		reg voter_fraud_scale /// DV
		c.covi_updated ///COVI
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year ///
		[pw=weight], robust cluster(state_fips)
		estimates store	gp_fraud_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		replace gen_pop_sample = 1 if e(sample) == 1		
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  dem=0 rep=0 liberalism=3 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=52 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)  ///
		saving(covi_fraud_gp, replace)

		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(gp_fraud_covi, replace) ///
		title(M2: COVI to Fraud Beliefs (All), size(medium) color(black)) ///
		ytitle("Voter Fraud Beliefs (0-100)", height(5)) ///
		yscale(r(0 100)) ylabel(0(20)100, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
		*COVI-->Confidence with fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year ///
		[pw=weight], robust cluster(state_fips)
		estimates store gp_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=34 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  dem=0 rep=0 liberalism=3 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=52 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(gp_state_covi_fraud, replace) ///
		title("M3: COVI (& Fraud) to Confidence (All)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  dem=0 rep=0 liberalism=3 poli_int=1 two_party_margin_perc=.14   /// Poli Characteristics
		age=52 income_mean=7 educ=3 married=1 female=1 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(state_scale_gen_b_fraud, replace) ///
		title("M3: Fraud (& COVI) to Confidence (All)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))

	*Mediation
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time  voted_early voted_mail  wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner rep dem liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner rep dem liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)   , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev)
		estimates store med_genpop
		esttab med_genpop
		
		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		), ///
		mediate(voter_fraud_scale) treat(covi_updated)  sims(1000)  
		
twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average mediation effect") xtitle("Sensitivity parameter: p") legend(off) title("Sensitivity Analysis for Full Sample(p)", color(black)) graphregion(color(white))

drop _med*	

*Independents
	*Covi-->Confidence no fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		  /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if ind == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	ind_state_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		  ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=3 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=51 income_mean=7 educ=3 married=1 female=0 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(ind_state_covi, replace) ///
		title(M4: COVI to Confidence (I), size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
	*COVI-->Fraud
		reg voter_fraud_scale /// DV
		c.covi_updated ///COVI
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if ind == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	ind_fraud_covi
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		replace ind_sample = 1 if e(sample)==1
			
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=3 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=51 income_mean=7 educ=3 married=1 female=0 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(ind_fraud_covi, replace) ///
		title(M5: COVI to Fraud Beliefs (I), size(medium) color(black)) ///
		ytitle("Voter Fraud Beliefs (0-100)", height(5)) ///
		yscale(r(0 100)) ylabel(0(20)100, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
	*Covi-->Confidence with Fraud
		reg confidence_statevote_binary /// DV
		c.covi_updated ///COVI
		voter_fraud_scale /// Fraud
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner  dem rep liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		i.year if ind == 1 ///
		[pw=weight], robust cluster(state_fips)
		estimates store	ind_state_covi_fraud
		estadd loc YearFE ="Yes"  
		estadd loc StateFE ="No"  
		estadd loc Controls = "Yes"
		
		margins, at(covi_updated=(-1.4(.2)1.4) ///
		voter_fraud_scale=35 ///
		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=3 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=51 income_mean=7 educ=3 married=1 female=0 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
 		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(none)) ///
		name(ind_state_covi_fraud, replace) ///
		title("M6: COVI (& Fraud) to Confidence (I)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle(Voting Inconvenience, height(5)) ///
		xlabel(-1.25 "Less" 0 "Balanced"  1.25 "More", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
		
		
		margins, at(voter_fraud_scale=(0(6.25)100) ///
		covi_updated=0 ///
 		voted_first_time=0 voted_early=0 voted_mail=0 wait_time4=2 reg_problem=0 machine_problem=0 difficulty_finding_poll=1 asked_photo=0  /// Voting Exp.
		voted_for_winner=0  liberalism=3 poli_int=1 two_party_margin_perc=.15   /// Poli Characteristics
		age=51 income_mean=7 educ=3 married=1 female=0 /// SES
		hispanic=0 black_non_hispanic=0 other_non_hispanic=0)
		marginsplot, ///
		recastci(rarea) ///
		plot1opts(msymbol(|)) ///
		name(state_scale_ind_b_fraud, replace) ///
		title("M6: Fraud (& COVI) to Confidence (I)", size(medium) color(black)) ///
		ytitle("Voter Confidence (0-1)", height(5)) ///
		yscale(r(0 1)) ylabel(0(.2)1, angle(0) labsize(small)) ///
		xtitle("Belief in Frequenecy of Voter Fraud", height(5)) ///
		xlabel(0 "Never" 25 "Rarely" 50 "Infreuqently" 75 "Occasionally" 100 "Frequently	", labsize(small)) ///
		graphregion(color(white)) ///
		ciopt(color(black)) ///
		plotopts(lcolor(black) mcolor(black))
		
	*Ind
		medeff (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail  wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		)  if ind  == 1 , ///
		mediate(voter_fraud_scale) treat(covi_updated -1.4 1.4) vce(cluster state_abbrev)
		estimates store med_ind
		esttab med_ind
		
 		medsens (regress voter_fraud_scale covi_updated ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		year) ///
		(logit confidence_statevote_binary covi_updated voter_fraud_scale ///
		voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
		voted_for_winner      liberalism poli_int two_party_margin_perc   /// Poli Characteristics
		age income_mean educ married female /// SES
		hispanic black_non_hispanic other_non_hispanic /// Race/Ethnicity
		) if ind  == 1 , ///
		mediate(voter_fraud_scale) treat(covi_updated  ) sims(1000)		
			
		twoway rarea _med_updelta0 _med_lodelta0 _med_rho, bcolor(gs14) || line _med_delta0 _med_rho , lcolor(black) ytitle("Average mediation effect") xtitle("Sensitivity parameter: p") legend(off) title("Sensitivity Analysis for Independent Sample(p)", color(black)) graphregion(color(white))

		drop _med*
		
********************************************************************************
********************************************************************************
********************************************************************************
*Table 1
********************************************************************************
********************************************************************************
********************************************************************************
		esttab gp_state_covi gp_fraud_covi gp_state_covi_fraud ind_state_covi ind_fraud_covi ind_state_covi_fraud ///
		using coll_COVI_Conf_T1GPIND.rtf, replace ///
		cells(b( fmt(3)) p(fmt(3) par)) ///
		label note("All models estimated with linear regression, robust standard errors clustered by state, include year fixed effects, and are weighted to be state representative of registered voters. P-values shown in parentheses.") ///
		ar2 obslast ///
		nodepvars nobase noomitted eqlabel("") interaction(" x ") ///
			order( covi_updated ///COVI
				voter_fraud_scale /// Fraud
				   ///
				 voted_first_time voted_early voted_mail wait_time4 reg_problem machine_problem difficulty_finding_poll asked_photo  /// Voting Exp.
				voted_for_winner  liberalism poli_int two_party_margin_perc   /// Poli Characteristics
				age income_mean educ married female /// SES
				hispanic black_non_hispanic other_non_hispanic  ) /// Laws 
				  ///
			drop(*.year) ///
		title("Table XX: Voter Restrictions, Voter Fraud Beliefs, and Voter Confidence Among All Respondents and Independents") ///
		mlabel("COVI to Confidence" "COVI to Fraud Beliefs" "COVI to Confidence w. Fraud Beliefs" ///
		"COVI to Confidence" "COVI to Fraud Beliefs" "COVI to Confidence w. Fraud Beliefs") ///
		mgroups("All Respondents" "Independents", pattern( 1 0 0 1 ))
		
********************************************************************************
********************************************************************************
********************************************************************************
*Figure 1
********************************************************************************
********************************************************************************
********************************************************************************
graph combine gp_state_covi gp_fraud_covi gp_state_covi_fraud ind_state_covi ind_fraud_covi ind_state_covi_fraud, ///
graphregion(color(white))
	